#ifndef GRAPHWIDGETOBJECT_H
#define GRAPHWIDGETOBJECT_H

#include <QPen>
#include <QString>
#include <QColor>
#include <QPointF>
#include <QVector>

class GraphWidgetObject
{
public:
    GraphWidgetObject(QColor color = Qt::white, float width = 1.0f, QString title = QString());
    GraphWidgetObject(const GraphWidgetObject& gwo);

    float minX();
    float minY();
    float maxX();
    float maxY();

    float width();
    QColor color();
    QPen pen();

    QString title();

    void setWidth(float width);
    void setColor(QColor color);

    void appendPoint(QPointF point);

    QVector<float> xValues();
    QVector<float> yValues();
    QVector<QPointF> values();

    float yValueAt(float xValue);
    QVector<float> yValuesAt(float x);

    QString type();

    virtual void draw(QPen pen) { Q_UNUSED(pen) }

    void draw();

    void select(QPen pen);

protected:
    void setupBounds();
    void adjustBoundsToPoint(QPointF point);

    QVector<QPointF> points;

    QPen objectPen;
    float xMin;
    float yMin;
    float xMax;
    float yMax;

    QString name;

};

#endif // GRAPHWIDGETOBJECT_H
